package oo;

class Fish{
 int weight;
}
class Lake{    
 Fish fish;
 void setFish(Fish s){
  fish = s;}
 void eat(int n){
  fish.weight =fish .weight + n;
  Fish liyu = new Fish();
  Fish niqiu = new Fish ();
  liyu.weight=niqiu.weight;
  System.out.println(liyu.weight);/////输出1
  }
}
class FishandLake{
 public static void main(String[] args) {
  Fish niqiu = new Fish();
  Fish liyu = new Fish();
  System.out.println(niqiu.weight);////输出2
  System.out.println(liyu.weight);//输出3
  Lake taihu  = new Lake();
  Lake tiantan = new Lake();
  taihu.setFish(niqiu);
  taihu.eat(15);
  tiantan.setFish(niqiu);
  System.out.println(tiantan.fish.weight);//输出4
  tiantan.eat(20);
  System.out.println(niqiu.weight);//输出5
  System.out.println(taihu.fish.weight);//输出6
  System.out.println(tiantan.fish.weight);//输出7
 }
 
}